package string;

public class StringBuilderDemo {
    public static void main(String[] args) {
        StringBuilder builder=new StringBuilder("a");//空字符串
        for(int i=0;i<10000000;i++){
            builder.append(i);
        }
        System.out.println("执行完毕");

        String str="abc";
        StringBuilder builder1=new StringBuilder(str);
        //将String转换成builder
        String str1=builder1.toString();
        //将builder转换为String

        String s="好好学习Java";
        StringBuilder builder2=new StringBuilder(s);
        builder2.append("，就是为了找到好工作");
        System.out.println(builder2);
        //替换
        builder2.replace(13,19,"marry cxk");
        System.out.println(builder2);
        //删除
        builder2.delete(0,8);//删除下标为0~7的
        System.out.println(builder2);
        //插入
        builder2.insert(0,"活着");
        System.out.println(builder2);


    }
}
